package android.test;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ListView;

public class CallLogListActivity extends Activity {

    private ListView mainListView;
    private CallLogArrayAdapter listAdapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listview);
        mainListView = (ListView) findViewById(R.id.listview);
        mainListView.setSmoothScrollbarEnabled(true);
        Bundle bun = getIntent().getExtras();
        int call_type = bun.getInt(CallLogActivity.CALL_TYPE);

        if(call_type == CallLogActivity.INCOMING_CALL){
            listAdapter = new CallLogArrayAdapter(this, CallLogActivity.incomingcalllist);

        }
        else if(call_type == CallLogActivity.OUT_GOING_CALL){
            listAdapter = new CallLogArrayAdapter(this, CallLogActivity.outgoingcalllist);

        }
        else if(call_type == CallLogActivity.MISS_CALL){
            listAdapter = new CallLogArrayAdapter(this, CallLogActivity.misscalllist);

        }
        mainListView.setAdapter(listAdapter);

    }

    public void initElement(){
        listAdapter.notifyDataSetChanged();
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.call_log_list, menu);
        return true;
    }

}
